#define _CRT_SECURE_NO_WARNINGS 1
#include<stack>
#include<iostream>
using namespace std;
class MinStack {
public:
	MinStack()
	{}

	void push(int val)
	{
		st.push(val);
		if (minst.empty()||val <= minst.top())
			minst.push(val);
	}

	void pop()
	{
		if (st.top() == minst.top())
			minst.pop();
		st.pop();
	}

	int top()
	{
		return st.top();
	}

	int getMin()
	{
		return minst.top();
	}

private:
	stack<int> st;
	stack<int> minst;
};

int main()
{
	MinStack s;
	s.push(-2);
	s.push(0);
	s.push(-3);
	cout << s.getMin() << endl;
	s.pop();
	cout << s.top() << endl;
	cout << s.getMin() << endl;
	return 0;
}